(function () {

    var clean = {
        getUrlParam :function(name){
            var url = decodeURI(location.search); //获取url中"?"符后的字串
            var theRequest = new Object();
            if (url.indexOf("?") != -1) {
                var str = url.substr(1);
                strs = str.split("&");
                for(var i = 0; i < strs.length; i ++) {
                    theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
                }
            }
            return theRequest[name];
        },
        clearStorage :function(){
            var self = this;
            console.log("进入cleanStorage");
            if (sessionStorage.getItem("cleanstorage") !== "1") {
                console.log("cleanStorage的session为0");
                var usercode = localStorage.getItem("userCode");
                var appusercode = self.getUrlParam("usercode");
                if (self.getUrlParam("cleanStorage") === "1" ) {
                    console.log("cleanstorage：清除缓存啦");
                    //获取引导的缓存
                    var tutorial = localStorage.getItem("tutorial");
                    var dynamcTip = localStorage.getItem("isFirst");
                    window.localStorage.clear();
                    window.sessionStorage.clear();
                    if(tutorial !== null){
                    	localStorage.setItem("tutorial",tutorial);
                    }
                    if(dynamcTip !== null){
                    	localStorage.setItem("isFirst",dynamcTip);
                    }                                      
                }
                sessionStorage.setItem("cleanstorage", "1");
            }
        }
    }

    clean.clearStorage();

})();
